﻿#!/usr/bin/env python
#
# GAE-Appengine-CMS
# Copyright (c) 2010 ITBelt (itbelt.com)
# Licensed under the GPL license:
# http://www.gnu.org/licenses/gpl.html
#

import os
import string
import datetime
import sys

from google.appengine.api import memcache
from django.utils import simplejson
import models

class NewsListControl():
    def process(self):
        handler=os.environ['handler']
        news_list = models.News.all().order("-created")
        handler.values['news_list'] = news_list
        
class NewsControl():
    def process(self):
        handler=os.environ['handler']
        
        seo_path = handler.args[1]
        if seo_path:
            news = models.News.getByUrl(seo_path)
            if news:
                handler.values['news'] = news
                return
            
        handler.end(403)
            